/// <reference path="../App.ts" />
/// <reference path="../../../Definitions/_3rd_part/jquery.d.ts" />

/// <reference path="../../../Definitions/_prod/Office.d.ts" />

(function () {
    "use strict";

    // ReSharper disable once InconsistentNaming
    var Office = Microsoft.Office.WebExtension;

    Office.initialize = (reason?) => {

        var app = new App();

        $(document).ready(function () {

            app.initialize();

            $('#get-data-from-selection').click(() => {

                Office.context.document.getSelectedDataAsync(Office.CoercionType.Text, function (result) {
                    if (result.status === Office.AsyncResultStatus.Succeeded) {
                        app.showNotification('The selected text is:', '"' + result.value + '"');
                    } else {
                        app.showNotification('Error:', result.error.message);
                    }
                });
            });
        });
    };
})();